package com.ruoyi.mobile.project.sms.service;

import com.github.pagehelper.PageHelper;
import com.ruoyi.db.sms.domain.SmsCoupon;
import com.ruoyi.db.sms.domain.SmsTopic;
import com.ruoyi.db.sms.domain.query.SmsTopicQueryVo;
import com.ruoyi.db.sms.mapper.SmsTopicMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;

@Service
public class WxSmsTopicService
{
    @Autowired
    private SmsTopicMapper topicMapper;

    public List<SmsTopic> queryList(int offset, int limit)
    {
        return queryList(offset, limit, null, null);
    }
//蔡江恩
    public List<SmsTopic> queryList(int offset, int limit, String sort, String order)
    {
        SmsTopicQueryVo topicQueryVo = new SmsTopicQueryVo();

        topicQueryVo.setOrder(order);
        topicQueryVo.setSort(sort);

        PageHelper.startPage(offset, limit);
        return topicMapper.selectSmsTopicList(topicQueryVo);
      //  return null;
    }

    public int queryTotal()
    {
        return 0;
    }
//蔡江恩
    public SmsTopic findById(Long id)
    {
         return topicMapper.selectSmsTopicById(id);
    }

    public List<SmsTopic> queryRelatedList(Long id, int offset, int limit)
    {
        SmsTopicQueryVo topicQueryVo = new SmsTopicQueryVo();
        List<SmsTopic> list1 = new ArrayList<>();
        PageHelper.startPage(offset, limit);
        int z = topicMapper.selectSmsTopicList(topicQueryVo).size();
        for (int i = 0; i < z; i++) {

            long a = topicMapper.selectSmsTopicList(topicQueryVo).get(i).getId();
            if(id!=a){
                list1.add(topicMapper.selectSmsTopicList(topicQueryVo).get(i));
            }

    }
        return  list1;}

    public List<SmsTopic> querySelective(String title, String subtitle, Integer page, Integer limit, String sort, String order)
    {
        return null;
    }

    public int updateById(SmsTopic topic)
    {
        return 0;
    }

    public void deleteById(Long id)
    {

    }

    public void add(SmsTopic topic)
    {

    }

    public void deleteByIds(List<Integer> ids)
    {

    }
}
